/**
 * Created by 游永年 on 2019-01-13 16:13.
 * 推荐老师页面
 */

'use strict'
import {Button, Flex, WhiteSpace} from 'antd-mobile';
import {connect} from 'dva';
import React, {Component} from 'react';
import TuiJianList from "./TuiJianList";
import {withRouter} from "react-router-dom";

@withRouter
class TuiJian extends Component {
  render() {
    const height = window.innerHeight * 0.8;
    const level = '中级';
    return (
      <Flex direction={'column'} justify={'start'} style={{height: `${height}px`}}>
        <h3>{`英语水平为${level}，为你推荐老师如下`}</h3>
        <TuiJianList/>
        <Button style={{width: '60%', border: '1px solid #ccc'}} onClick={this.reTest}>重新测试</Button>
        <WhiteSpace/>
        <Button type={'primary'} style={{width: '60%'}}>更多老师</Button>
      </Flex>
    );
  }

  /**
   * 重新测试
   * @param _
   */
  reTest = _ => {
    const {dispatch, history} = this.props;
    //重新拉题目
    dispatch({type: 'quiz/fetchTimus', body: {tmSource: {type: 1}}});
    //路由回去
    history.push('/book/firstTest/test');
  }
}

TuiJian.propTypes = {};

export default connect()(TuiJian);
